﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Doan_ver1
{
    public partial class WebForm9 : System.Web.UI.Page
    {
        public string connection()
        {
            return Provider.connectionString();
        }
      // public static String connectionString = "Data Source=RICARDOQUI-PC;Initial Catalog=NGANHANG;Integrated Security=SSPI";
       
        protected void Page_Load(object sender, EventArgs e)
        {
            SQLNganHangDataContext data = new SQLNganHangDataContext(connection());
            if (Session["khachhang"] == null)
                Response.Redirect("DangNhap.aspx");
            
            TaiKhoan tk = data.TaiKhoans.Where( c=>c.TenDangNhap == Session["khachhang"] as string).FirstOrDefault();
            var lst = data.Thes.Where(c => c.MaTaiKhoan == tk.MaTaiKhoan);
            
            foreach (var the  in lst)
            {
                var lstChiTietGD = from b in data.ChiTietGD_Thes
                                   where b.MaTheGui == the.MaThe
                                   select new
                                   {
                                       ID = b.MaChiTietGD_The,
                                       MaTheGui =b.MaTheGui,
                                       MaTheNhan=b.MaTheNhan,
                                       SoTien = b.SoTien,
                                       NgayGD =b.NgayGD
                                   };
                GridView1.DataSource = lstChiTietGD;
                GridView1.DataBind();
            }

        }
    }
}